import React from 'react';
import { Form } from 'antd';
import { SelectCustom } from '@/containers';
import LimitInput from '@/components/LimitInput';

const Performance = ({ form, data, ...rest }) => {
    const { getFieldDecorator } = form;

    const { quarterlyPerformanceAssessVO } = data || {};

    return (
        <Form {...rest}>
            <Form.Item label="绩效考核要求">
                <div style={{ display: 'flex' }}>
                    综合各季度绩效不低于
                    {getFieldDecorator('quarterlyPerformanceAssessVO.requirementsLevel', {
                        initialValue: quarterlyPerformanceAssessVO?.requirementsLevel || 'B',
                        rules: [
                            {
                                required: true,
                                message: '绩效考核要求不能为空'
                            }
                        ]
                    })(
                        <SelectCustom
                            allowClear={false}
                            style={{ width: 154, margin: '4px 8px 0' }}
                            dataSource={[
                                { label: 'S', value: 'S' },
                                { label: 'A', value: 'A' },
                                { label: 'B', value: 'B' },
                                { label: 'C', value: 'C' },
                                { label: 'D', value: 'D' }
                            ]}
                        />
                    )}
                    级则为合格，反之则不合格
                </div>
            </Form.Item>
            <Form.Item label="绩效指标说明" style={{ marginBottom: 12, maxWidth: 800 }}>
                {getFieldDecorator('quarterlyPerformanceAssessVO.performance', {
                    initialValue: quarterlyPerformanceAssessVO?.performance || ''
                })(
                    <LimitInput
                        area
                        placeholder="请输入绩效指标说明"
                        autoSize={{ minRows: 3, maxRows: 6 }}
                        maxLength={4000}
                    />
                )}
            </Form.Item>
        </Form>
    );
};

export default Performance;
